<%@ page language='java' contentType='text/html; charset=UTF-8' pageEncoding='UTF-8' %>
<%@ taglib uri='ctp-tag' prefix='ctp' %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
        <title></title>

        <ctp:include items='public,validator,borderlayout,panel,label,tablelayout,gridlayout,button,groupbox,image,message_ex'/>
       	<script type="text/javascript" src="<ctp:out name='fullPath'/>js/changeskins.js"></script>
        <ctp:if test="errRetPath == null">
  		<ctp:set name="errRetPath" value="request.getParameter('errRetPath')"/>
  		</ctp:if>
		<ctp:set name="errorMsg" value="request.getParameter('errorMsg')"/>
        <script type='text/javascript' kind='variant'>

            var panel1;
            var showLayout,detailsLayout;
            var showGroupbox,detailGroupbox;
        </script>
        <script type='text/javascript' kind='event'>
			var ButtomErrorCode,ButtomMsg,ErrorMsg,Exception,ExceptionMsg,ExceptionStackMsg,ErrRetPath,second=3,flag=true;
			try{
			Exception='<ctp:out name="CTPException.getButtomErrorCode()"/>';
			ButtomErrorCode='<ctp:out name="CTPException.getButtomErrorCode()"/>';
			ButtomMsg='<ctp:out name="CTPException.getButtomMsg()"/>';
			ErrorMsg='<ctp:out name="errorMsg"/>';
			ErrRetPath='<ctp:out name="errRetPath"/>';
			}
			catch(e){
			ButtomErrorCode='Sorry!There is no error code!';
			ButtomMsg='Sorry!There is no error message!';
			}
			
			
			
        </script>
        <script type='text/javascript' kind='ui'><!--
	
            $(window).load(function(){
            	if(Exception == "channel4ctp-0032" || Exception == "channel4ctp-0033" ||Exception == "channel4ctp-0034"){
                	var label1=new ctp.ui.label({
    			  	    id: 'label1',
    					width: '300px',
    					textAlign: 'left',
    					text: "您的会话已超时，可进行下列操作。<br/>session timeout,please relogin.<br/><br/><br/><br/>"				   
    			     });
                	var label2=new ctp.ui.label({
    			  	    id: 'label2',
    					width: '300px',
    					textAlign: 'left',
    					text: "<br/><br/><div style='font-size:18px;font-weight:blod'>超时提示(timeout notice!)</div>"				   
    			     });
                	var label3=new ctp.ui.label({
    			  	    id: 'label3',
    					width: '300px',
    					textAlign: 'left',
    					text: "<br/><br/><br/><br/>"				   
    			     });
                	var image1 = new ctp.ui.image({
                        id: 'image1',
                        width: '70px',
                        height:'70px',
                        hasBorder:false,
                        imgSrc: '<ctp:out name="fullPath"/>images/public/notice.png'
                    });
                	var button1=new ctp.ui.button({
                        id: 'button1',
                        text: "<div style='font-weight:blod'>登陆(Login)</div>",
                        width: '90px',
                        onClick: function(){
							top.location.href='index.jsp';
                        }
                    });
                      var button2=new ctp.ui.button({
                        id: 'button2',
                        text: '退出(Exit)',
                        width: '90px',
                        onClick: function(){
							top.window.close();
                        }
                    });
    				
    				 showLayout = new ctp.ui.tablelayout({
                        id: 'showLayout',
                        width: '95%',
                        cols: 2,
                        align: 'center',
                        colsWidth:['95px','100%'],
                        colSpace: 2,
                        items: [[{element: label3}],
                                [{element: image1},{element:label2}],
                                [{colspan: 2,element: label1}],
                                [{element: button1},{element: button2}]]
                    
                    });
                	panel1 = new ctp.ui.panel({
                        id: 'panel1',
                        style: 'none',
                        width: '80%',
                        height: 'auto',
    					items: [showLayout],
                        renderTo: 'container'
                    });
                    $("#_ctp_panel_content_panel1").css({"margin-left":"100px"});
                }
            	else{
				var label1=new ctp.ui.label({
			  	    id: 'label1',
					width: '100%',
					textAlign: 'left',
					text: '<ctp:label key="trade_display_wrong"/>'				   
			     });
			     var label2=new ctp.ui.label({
			  	    id: 'label2',
					width: '100%',
					textAlign: 'left',
					text: '<ctp:label key="wrong_message"/>'+ErrorMsg				   
			     });
			     var label3=new ctp.ui.label({
			  	    id: 'label3',
					width: '100%',
					textAlign: 'left',
					text: '<ctp:out name="errorMsg"/>'				   
			     });
			     var label4=new ctp.ui.label({
			  	    id: 'label4',
					width: '100%',
					textAlign: 'left',
					text: '<ctp:label key="wrong_code"/>'+ButtomErrorCode			   
			     });
			     var label5=new ctp.ui.label({
			  	    id: 'label5',
					width: '100%',
					textAlign: 'left',
					text: '<ctp:label key="wrong_description"/>'+ButtomMsg				   
			     });
			     var labelDetail=new ctp.ui.label({
			  	    id: 'labelDetail',
					width: '100%',
					textAlign: 'left',
					text: '<ctp:label key="wrong_content"/><ctp:out name="CTPException.getMessage()"/><br /><ctp:label key="wrong_stack"/><ctp:out name="CTPException.getErrorStackMsg()"/><br />'				   
			     });
			     var button1=new ctp.ui.button({
                    id: 'button1',
                    text: '<ctp:label key="returnbutton"/>',
                    icon:'back',
                    width: '80%',
                    onClick: function(){
                    ErrRetPath?document.returnForm.submit():history.go(-1);
                    }
                });
                  var button2=new ctp.ui.button({
                    id: 'button2',
                    text: '<ctp:label key="relogon"/>',
                    icon:'reload',
                    width: '80%',
                    onClick: function(){
                    top.location.href='index.jsp';
                    }
                });
                  var image1 = new ctp.ui.image({
                    id: 'image1',
                    width: '32px',
                    height:'32px',
                    imgSrc: '<ctp:out name="fullPath"/>images/messagebox/err.gif'
                });
				  var showItem=new Array();
				  showItem.push([{colwidth: '6%',element: image1},{colwidth: '80%',element: label1}]);
				  if(ErrorMsg){
				  showItem.push([{colspan: 4,element: label2},{element: button1}]);
				  }
				  if(Exception){
				  showItem.push([{colspan: 5,element: label4}]);
				  if(ButtomErrorCode=='channel4ctp-0034' || ButtomErrorCode=='userctrl4ctp-0001'){
				  showItem.push([{colspan: 4,element: label5},{element: button2}]);
				  }else{
				  showItem.push([{colspan: 4,element: label5},{element: button1}]);
				  }
				  }
				 showLayout = new ctp.ui.gridlayout({
                    id: 'showLayout',
                    width: '95%',
                    cols: 5,
                    align: 'center',
                    colSpace: 2,
                    items: showItem
                
                });
              	   showGroupbox = new ctp.ui.groupbox({
               	       id: 'showGroupbox',
               	       width:"95%",
					   title:'<ctp:label key="error_summary"/>',
              	       items: [showLayout]
             	    });
				  detailsLayout = new ctp.ui.gridlayout({
					id:'detailsLayout',
                    width: '95%',
                    cols: 1,
                    align: 'center',
                    items: [
					     [{element: labelDetail}]
					]
                
                }); 
				 detailGroupbox=new ctp.ui.groupbox({
			  	    id: 'detailGroupbox',
			  	    width:"95%",						
					items:[detailsLayout],
					title:'<ctp:label key="error_details"/>'						   
			     });
			       panel1 = new ctp.ui.panel({
                    id: 'panel1',
                    style: 'border',
                    width: '98%',
                    height: 'auto',
					align:'center',
					textAlign:'center',
                    items: [showGroupbox,detailGroupbox],
                    renderTo: 'container'
                });
            	}
			    });
        --></script>
    </head>
    <body>
    <div id="container" style="width:100%;height:95%;"></div>
  	<ctp:if test="errRetPath!=null && errRetPath!=''">
  		<form name="returnForm" method="post" action="<ctp:out name="errRetPath"/>">
  		</form>
  	</ctp:if>
    </body>
</html>
